package com.cw.jeeyt.dao.impl.process;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.common.Order;
import com.cw.jeeyt.dao.intf.process.ActReProcdefDao;
import com.cw.jeeyt.dao.mapper.process.ActReProcdefMapper;
import com.cw.jeeyt.dao.model.process.ActReProcdefDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * 流程定义 dao数据库操作接口
 *
 * @author chenw
 * @date 2019-03-13 22:15:39
 */
@Repository
public class ActReProcdefDaoImpl implements ActReProcdefDao {
    @Autowired
    private ActReProcdefMapper actReProcdefMapper;

    /**
     * 新增流程定义
     *
     * @param actReProcdef
     * @return 整数
     */
    public Integer insert(ActReProcdefDo actReProcdef) {
        return actReProcdefMapper.insert(actReProcdef);
    }

    /**
     * 新增流程定义不为空的字段
     *
     * @param actReProcdef
     * @return 整数
     */
    public Integer insertSelective(ActReProcdefDo actReProcdef) {
        return actReProcdefMapper.insertSelective(actReProcdef);
    }

    /**
     * 删除流程定义
     *
     * @param actReProcdef
     */
    public void delete(ActReProcdefDo actReProcdef) {
        actReProcdefMapper.delete(actReProcdef);
    }

    /**
     * 修改流程定义不为null的字段
     *
     * @param actReProcdef
     */
    public void updateSelective(ActReProcdefDo actReProcdef) {
        actReProcdefMapper.updateSelective(actReProcdef);
    }

    /**
     * 修改流程定义
     *
     * @param actReProcdef
     */
    public void update(ActReProcdefDo actReProcdef) {
        actReProcdefMapper.update(actReProcdef);
    }

    /**
     * 根据主键查询流程定义
     *
     * @return 流程定义
     */
    public ActReProcdefDo getById(String id_) {
        return actReProcdefMapper.getById(id_);
    }

    /**
     * 查询所有流程定义
     *
     * @return 流程定义集合
     */
    public List<ActReProcdefDo> queryActReProcdefList() {
        return actReProcdefMapper.queryActReProcdefList();
    }

    /**
     * 分页查询流程定义
     *
     * @param actReProcdef 查询条件
     * @param startNum 开始条数
     * @param pageSize 每页长度
     * @return 流程定义集合
     */
    public PageInfo<ActReProcdefDo> queryByPage(ActReProcdefDo actReProcdef, Integer startNum, Integer pageSize,
        Order order) {
        PageHelper.startPage(PageUtil.calPageNum(startNum, pageSize), pageSize);
        return new PageInfo<>(actReProcdefMapper.queryByPage(actReProcdef, order));
    }
}
